package gov.pbc.nn.kjgl.archive.view;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;

import gov.pbc.nn.kjgl.archive.dao.ArchivesTwoDao;
import gov.pbc.nn.kjgl.entity.Archives;

@Component
public class ArchivesTwoPR {
	@Autowired
	private ArchivesTwoDao archivesTwoDao;
	
	@DataProvider
	public List<Archives> getArchives(){
		return archivesTwoDao.getArchives();
	}
	 
	@DataProvider
	public List<Archives> getArchivesByParentId(String parentId){
		return archivesTwoDao.getArchivesByParentId(parentId);
	}
	
	@Transactional
	@DataResolver
	public void saveArchives(Collection<Archives> archives){
		archivesTwoDao.saveArchives(archives);
	}
	
	@Expose
	@Transactional
	public boolean checkName(String parentId,String name){
		return archivesTwoDao.checkName(parentId,name);
	}
}

